import axios from 'axios'
import { Message } from 'element-ui'
import { saveAs } from 'file-saver'
import { getToken } from '@/utils/auth'

const baseURL = process.env.VUE_APP_BASE_API

export default {
  pdf(url, param) {
    var url = baseURL + url
    axios({
      method: 'post',
      url: url,
      data: param,
      responseType: 'blob',
      headers: { 'Authorization': 'Bearer ' + getToken() }
    }).then(async (res) => {
        const blob = new Blob([res.data], { type: 'application/pdf' })
        this.saveAs(blob, "个人简历");
    })
  },
  saveAs(text, name, opts) {
    saveAs(text, name, opts);
  }
}

